jQuery(document).ready(function () {
    jQuery('#addForm').validate({
        rules: {
			            // id: { required: false },
                        // name: { required: false },
                        // type: { required: false },
                        // url: { required: false },
                        // parentId: { required: false },
                        // parentIds: { required: false },
                        // permission: { required: false },
                        // available: { required: false },
                        // id: { required: false },
                        // name: { required: false },
                        // type: { required: false },
                        // url: { required: false },
                        // parentId: { required: false },
                        // parentIds: { required: false },
                        // permission: { required: false },
                        // available: { required: false },
            			xyz :{ required:false }
        },
        messages: {
		//                uId: {required: " * 不能为空！", minlength: " * 不能为空！"},
		//                uId: {required: " * 不能为空！", minlength: " * 不能为空！"},
		//                uId: {required: " * 不能为空！", minlength: " * 不能为空！"},
		//                uId: {required: " * 不能为空！", minlength: " * 不能为空！"},
		//                uId: {required: " * 不能为空！", minlength: " * 不能为空！"},
		//                uId: {required: " * 不能为空！", minlength: " * 不能为空！"},
		//                uId: {required: " * 不能为空！", minlength: " * 不能为空！"},
		//                uId: {required: " * 不能为空！", minlength: " * 不能为空！"},
		//                uId: {required: " * 不能为空！", minlength: " * 不能为空！"},
		//                uId: {required: " * 不能为空！", minlength: " * 不能为空！"},
		//                uId: {required: " * 不能为空！", minlength: " * 不能为空！"},
		//                uId: {required: " * 不能为空！", minlength: " * 不能为空！"},
		//                uId: {required: " * 不能为空！", minlength: " * 不能为空！"},
		//                uId: {required: " * 不能为空！", minlength: " * 不能为空！"},
		//                uId: {required: " * 不能为空！", minlength: " * 不能为空！"},
		//                uId: {required: " * 不能为空！", minlength: " * 不能为空！"},
						xyz :{ required: " *xyz不能为空！" }
        },

        errorElement: 'div',
        errorClass: 'help-block',
        focusInvalid: false,
        invalidHandler: function (event, validator) { //display error alert on form submit
            //$('.alert-danger', $('.login-form')).show();
        },
        highlight: function (e) {
            jQuery(e).closest('.form-group').removeClass('has-info').addClass('has-error');
        },
        success: function (e) {
            jQuery(e).closest('.form-group').removeClass('has-error').addClass('has-info');
            jQuery(e).remove();
        },
        submitHandler: function (form) {
            jQuery('#addForm').ajaxSubmit({
                url: '/sys_resource/save-sys_resource.ajax',
                type: 'post',
                dataType: 'json',
                success: function (json, statusText, xhr, $form) {
                    if (json._success) {
                        window.location.href = '/sys_resource/list-sys_resource.html';
                    } else {
                        alert(json._msg);
                    }
                }
            });
        }
    });
});